from torch.utils.tensorboard import SummaryWriter as sw
from PIL import  Image
import  numpy as np


writer = sw("../logs")

#biao liang
# for i in range(100):
#     writer.add_scalar("y=3x",3*i,i)


img_path = "../data/edata/train/bees/90179376_abc234e5f4.jpg"


img = Image.open(img_path)
print(type(img))
# <class 'PIL.JpegImagePlugin.JpegImageFile'>
img = np.array(img)
print(type(img))
# <class 'numpy.ndarray'>
print(img.shape)
# (332, 500, 3)
writer.add_image("test" , img , 1 , dataformats="HWC")


writer.close()